<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ShadowDOM</title>
    <style>
        h1 {
            color: #fce6ec;
        }
    </style>
</head>
<body>
    <h1>Hello Light DOM</h1>
    <hello-shadow-dom></hello-shadow-dom>
    <script>
        class HelloShadowDom extends HTMLElement {
            constructor() {
                super();
                const shadowDOM = this.attachShadow({mode: 'open'});
                const container = document.createElement('h1');
                container.innerHTML = 'Hello Shadow DOM';
                container.id = 'container';
                shadowDOM.appendChild(container);
                this.addColor()
            }
            addColor() {
                const container = this.shadowRoot.getElementById('container');
                container.style.color = '#f498b2';
            }
        }
        customElements.define('hello-shadow-dom', HelloShadowDom);
    </script>
</body>
</html>